<template>
    <div>
        <van-nav-bar
                title="账户设置"
                @click-left="leftButton"
                left-arrow
        />
        <van-cell>
            <template>{{user.userName}}</template>
            <template #extra>
                <span style="color: red;font-weight: bold">当前登录</span>
            </template>
            <template #icon>
                <img style="width:60px; height:60px; border-radius:50%; " :src="user.userPhoto"/>
                <!--<van-image style="width:50px;padding-right: 20px" round
                           src="https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1671247724,3484152546&fm=26&gp=0.jpg"/>-->
            </template>
            <br>
            <template>
                手机号：<span>{{user.userPhoneNumber}}</span>
            </template>
        </van-cell>


        <van-cell-group>
            <van-cell title="收货地址管理" to="/myAddress" is-link value="管理我的地址"/>
        </van-cell-group>

        <br>
        <van-cell-group>
            <van-cell title="账户安全" to="/AccountSecurity" is-link value="密码/实名认证等操作"/>
            <van-cell title="支付密码" is-link value="已设置"/>
        </van-cell-group>

        <br>
        <van-cell-group>
            <van-cell title="入驻商家" is-link value="自己开店挣大钱"/>
            <van-cell title="联系客服" is-link value="即时解答用户疑问"/>
        </van-cell-group>

        <br>
        <van-cell-group>
            <van-cell title="退出登录" is-link value="" v-on:click="down"/>
        </van-cell-group>


    </div>
</template>

<script>
    import axios from "axios"
    export default {
        name: "MyAccountSetting",
        data() {
            return {
                user: [],
            }
        },

        created() {
            this.start();
        },

        methods: {
            start(){
                var storage = window.localStorage;
                var user = JSON.parse(storage.getItem("user"));

                axios.get('http://localhost:8001/sign/redisQuery',{
                    params: {
                        uid: user
                    }
                }).then(result => {
                    if (result.data != ""){
                        this.user = result.data;
                    }else{
                        this.$router.push("/login");
                    }
                })

            },
            leftButton() {
                this.$router.back()
            },

            down(){
                localStorage.removeItem('user');
                this.$router.push("/login");
            }

        }

    }



</script>

<style scoped>
</style>
